<?php
namespace Home\Model;

use Think\Model;

class AgentApplyModel extends Model {
	
	protected  $_validate = array(
		array('tel','require','请填写电话',self::MODEL_BOTH),
		array('tel', 'getTel', '不是正确的手机格式', self::MUST_VALIDATE, 'callback', self::MODEL_BOTH),
		array('name','require','请填写姓名',self::MODEL_BOTH),
	);
	
	protected $_auto = array(
		array('createTime', 'time', self::MODEL_INSERT, 'function'),
	);
	
	public function getTel() {
		$tel = I('tel');
		return preg_match('/^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$|17[0-9]{9}/', $tel) ? true : false;
	}
}